#ifndef DEVCOMMON_H
#define DEVCOMMON_H

#include "devcommon_global.h"
#include <QtGlobal>
#include <QColor>
#include <QRect>
#include <QRectF>
#include <QFont>
#include <QApplication>

class QApplication;
namespace Devcommon
{

DEVCOMMONSHARED_EXPORT bool registerTrustedExe(const QString& exePath = QApplication::applicationDirPath());
DEVCOMMONSHARED_EXPORT bool loadTranslator(const QString& qm);
DEVCOMMONSHARED_EXPORT bool loadTranslatorFromPath(const QString& path=QString("/usr/share/deepin-defender-mil/translations"));

DEVCOMMONSHARED_EXPORT void delay_ms(int milliseconds);

DEVCOMMONSHARED_EXPORT Qt::GlobalColor toColorType(const QColor &color);

DEVCOMMONSHARED_EXPORT inline int adjustColorValue(int base, qint8 increment, int max = 255);

DEVCOMMONSHARED_EXPORT QColor adjustColor(const QColor &base,
                                          qint8 hueFloat, qint8 saturationFloat, qint8 lightnessFloat,
                                          qint8 redFloat, qint8 greenFloat, qint8 blueFloat, qint8 alphaFloat);


// 函数：计算字符串宽度
DEVCOMMONSHARED_EXPORT QRect calcStringSize(const QString &text, const QFont &font);

};


#endif // DEVCOMMON_H
